make sure CompleteWriter is enforcing the right invariants#7056
Merged
Xuanwo merged 1 commit intoapache:mainfrom Jan 19, 2026
Merged
make sure CompleteWriter is enforcing the right invariants#7056Xuanwo merged 1 commit intoapache:mainfrom
Xuanwo merged 1 commit intoapache:mainfrom
Conversation
Contributor
Author
|
@Xuanwo throwing this up for discussion. It currently fails the match w.close().await {
Ok(_) => (),
Err(_) => {
w.abort().await.unwrap();
}
};But it seems that close/abort is somewhat inconsistent throughout. It seems like most of the code expects that if close fails you don't need to call abort. I'd like to understand what the actual intention of close vs abort is, and when users are expected to call them. Then it may be worthwhile to enforce the correct invariants in the CompleteWriter. |
Contributor
Author
|
if write completes without error then close/abort must be called, but it's ok if they fail |
96f86dd to
98284e2
Compare
c416611 to
930fbbf
Compare
930fbbf to
be7d802
Compare
Xuanwo
approved these changes
Jan 19, 2026
Member
Xuanwo
left a comment
There was a problem hiding this comment.
Thank you for working on this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #7044.
Rationale for this change
Initially, the rationale was that the CompleteWriter emits an erroneous warning when an error occurs before it's able to set
self.inner = None.However, upon inspection, it seems like CompleteWriter should enforce a more precise invariant: once the write completes without error, then close or abort must be called.
What changes are included in this PR?
Updates to CompleteWriter to enforce more precise invariants.
Are there any user-facing changes?
AI Usage Statement
No AI used other than in-IDE code completion.